<?php

class BoardCell {
	
	private $name;
	private $position;
	private $pass_over; //This could be an array
	private $land_on; //This could be an array
	private $type;
	private $color = "";
	
	public function __construct($options)
	{
		$this->type 	 = $options['type'];
		$this->name 	 = $options['name'];
		$this->position  = $options['position'];
		$this->pass_over = $options['pass_over'];
		$this->land_on	 = $options['land_on'];
		$this->color	 = $options['color'];
	}

	public function getName()
	{
		return $this->name;
	} 
	
	public function getType()
	{
		return $this->type;
	}
	
	public function getPosition() {
		return $this->position;
	}
	
	public function getColor(){
		return $this->color;
	}
	
	public function passOverPlayerAction($player)
	{
		foreach($this->pass_over as $action) {
			$action_parts = explode(':', $action);
			
			$function = $action_parts[0];
			$param = $action_parts[1];
			
			$player->$function($param);
		}
	}
	
	public function landOnPlayerAction($player)
	{
		foreach($this->land_on as $action)
		{
			$action_parts = explode(':', $action);
			$function = $action_parts[0];
			$param = $action_parts[1];
			$player->$function($action_parts[1]);
		}
	}

}